﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ECItemReAgrupadoPanel.ascx.cs"
 Inherits="UILGestion.Control.ECItemReAgrupadoPanel" %>
<%@ Register Assembly="WebLib" Namespace="WebLib" TagPrefix="cc1" %>
<%@ Register Assembly="CustomControls" Namespace="CustomControls" TagPrefix="cc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<link href="../../css/main.css" rel="stylesheet" type="text/css" />

 
     



           
               <asp:Panel ID="Panel1" runat="server" CssClass="Heading secTitle AreaHeading ms-crm-List-Header " >
               Re Agrupar Recursos 
                </asp:Panel>
              
                <asp:Panel ID="REUSOPanel" runat="server"    Width="100%"     class="ms-crm-Form-Body"  >

        
           <input id="idreUsoECItemList" type="hidden"  runat="server" />
           
            <input id="idEstructuraCosto" type="hidden"  runat="server" />
            <input id="idNewInsumosECItemList" type="hidden"  runat="server" />
            
            <asp:UpdatePanel ID="AddECItemUpdatePanel" runat="server"   UpdateMode="Conditional">
         <ContentTemplate>

             <table width="100%">
             <tr>
             <td>
             

             <table >
             <tr>
             <td></td>
             <td></td>
             </tr>

                 

                 <tr>
                 <td></td>
                 <td align="left">
                    
                   
                    
                      

                 </td>
                 </tr>

                 </table>


                 </td>
             <td align="right">
               
                   <asp:UpdatePanel ID="totalesUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            
<table  width="800px" >
            <tr>
                    <td  align="right">
                        &nbsp;Total Recurso:</td>
                    <td >
                       
                        <asp:Label ID="TotalRecursoLabel" runat="server"></asp:Label>
                       
                    </td>
                    <td align="right">
                        Total detalle:</td>
                    <td>
                        <asp:Label ID="TotalDetalleLabel" runat="server"></asp:Label>
                    </td>
                    <td align="right">
                        Saldo:</td>
                    <td width="100px" >
                        <asp:Label ID="saldoLabel" runat="server" Text=""></asp:Label>
                    </td> 
                 
                </tr>
            </table>
            </ContentTemplate>
            </asp:UpdatePanel>                                             
 

             </td>
             </tr>
             </table>
         </ContentTemplate>
            </asp:UpdatePanel>   
     

          
            <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1"  Width="100%" >
           
           
            <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="Comparativos Finalizados">
            <ContentTemplate>
            <asp:UpdatePanel ID="recursoItemUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
         
            <table><tr>
            <td style="font-size=x-small;">
            <b>Moneda:</b>
            </td><td><cc2:DropDownCC ID="MonedaSeleccionDropDownList" runat="server" 
                             AutoPostBack="true" Font-Names="Arial" Font-Size="X-Small" 
                             onselectedindexchanged="MonedaSeleccionDropDownList_SelectedIndexChanged" 
                             Width="200"></cc2:DropDownCC>
                             </td></tr></table>
              <input id="simbolMonedaLabel" type="hidden"  runat="server" />


             <asp:Panel ID="Panel15" runat="server" Height="320px" ScrollBars="Vertical" BackColor="White" 
                       BorderColor="LightSteelBlue" BorderStyle="Solid" BorderWidth="1px"   >
                       

                             <asp:GridView ID="reUsoECItemGridView" 
               SkinID="GridView" 
                 Width="100%"
                  runat="server" 
                
                DataKeyNames="idInternal" 
                onrowcancelingedit="CancelItem" 
                onrowediting="EditItem" 
                OnRowUpdating="UpdateItem" 
              >
                <Columns>
                <asp:TemplateField HeaderText="Comparativo Finalizado" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="75px">
                <ItemTemplate><asp:Label ID="comparativoLabel" runat="server"
                 BackColor="Transparent" Text='<%# Eval("comparativo")%>'  /></ItemTemplate>
                 <EditItemTemplate><asp:Label ID="comparativoEditLabel" runat="server" BackColor="Transparent"
                  Text='<%# Eval("comparativo")%>' /></EditItemTemplate></asp:TemplateField><asp:TemplateField 
                  HeaderText="Codigo" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="75px"><ItemTemplate>
                  <asp:Label ID="codigoLabel" runat="server" BackColor="Transparent" Text='<%# Eval("codigo")%>'  />
                  </ItemTemplate><EditItemTemplate><asp:Label ID="codigoEditLabel" runat="server"
                   BackColor="Transparent" Text='<%# Eval("codigo")%>'  /></EditItemTemplate>
                   </asp:TemplateField>
                   <asp:TemplateField HeaderText="Descripcion" 
                   HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="350px"><ItemTemplate>
                   <asp:Label ID="descripcionLabel" runat="server" BackColor="Transparent" Text='<%# Eval("descripcion")%>'  />
                   </ItemTemplate>
                   
                   <EditItemTemplate>
                   <asp:Label ID="descripcionEditLabel" 
                   runat="server" BackColor="Transparent" Text='<%# Eval("descripcion")%>'  />
                   </EditItemTemplate>
                   </asp:TemplateField>
                   <asp:TemplateField HeaderText="Unidad" 
                   HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="55px"><ItemTemplate>
                   <asp:Label ID="unidadLabel" runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>'  />
                   </ItemTemplate><EditItemTemplate>
                   
                   
                   <asp:Label ID="unidadEditLabel" 
                   runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>'  />
                   </EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Total Disp" 
                   HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px">
                   <ItemTemplate><asp:Label ID="totalDispLabel" runat="server" BackColor="Transparent" 
                   Text='<%# Eval("totalDispStr")%>'  /></ItemTemplate><EditItemTemplate>
                   <asp:Label ID="totalDispEditLabel" runat="server" BackColor="Transparent"
                    Text='<%# Eval("totalDispStr")%>'  /></EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Total Reuso" HeaderStyle-HorizontalAlign="Right"
                      ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px"><ItemTemplate><asp:Label ID="totalReUsoLabel" 
                      runat="server" BackColor="Transparent" Text='<%# Eval("totalReUsoStr")%>'  />
                      </ItemTemplate><EditItemTemplate><cc2:PostTextBox ID="totalDispEditTxt" runat="server"
                       BackColor="Transparent" DataType="Double" Text='<%# Eval("totalReUso")%>' />
                       </EditItemTemplate>
                       </asp:TemplateField>
                       <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/cancel.gif"  HeaderStyle-Width="20px"
                            EditImageUrl="~/Images/edit.gif" ShowEditButton="true" 
                            UpdateImageUrl="~/Images/update.gif" />
                            <asp:TemplateField HeaderStyle-Width="20px" >
                            
                            <ItemTemplate>
                            <asp:ImageButton ID="lnkRemove" runat="server" BorderColor="Control"  
                                    CommandArgument='<%# Eval("idInternal")%>' OnClick="DeleteItem" 
                                    OnClientClick="return confirm('Usted quiere eliminar?')"  ImageUrl="~/Images/delete.gif"   /></ItemTemplate></asp:TemplateField></Columns>
                                    </asp:GridView>

 
                                    
                                    
                                    </asp:Panel>
                                   
                                   
                                    </ContentTemplate>
                                    </asp:UpdatePanel>
              </ContentTemplate>
                </asp:TabPanel>
                                    
                                    
        <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="Nuevo Uso">
        <ContentTemplate>

         <asp:Panel ID="Panel16" runat="server" Height="330px" ScrollBars="Vertical" BackColor="White" 
                       BorderColor="LightSteelBlue" BorderStyle="Solid" BorderWidth="1px"   >

                       <asp:LinkButton runat="server"  ID="addOCBTN"></asp:LinkButton>


        <asp:UpdatePanel ID="recursoNewItemUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
        <asp:GridView ID="nuevoUsoAgrupadoGridView" 
                SkinID="GridView" 
                    ShowFooter="true"
                Width="100%"
                 
                runat="server" 
               
                DataKeyNames="idInternal" 
                onrowcancelingedit="CancelNewItem" 
                onrowediting="EditNewItem" 
                OnRowUpdating="UpdateNewItem" 
              >
                <Columns>
                <asp:TemplateField HeaderText="Codigo" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="75px">
                <ItemTemplate>
                <asp:Label ID="codigoLabel" runat="server" BackColor="Transparent" Text='<%# Eval("codigo")%>'  Width="75px" />
                </ItemTemplate>
                <EditItemTemplate>
                <cc2:PostTextBox ID="codigoEditTxt" runat="server"  BackColor="Transparent" Text='<%# Eval("codigo")%>' 
                Width="75px" ReadOnly="true"
                 />
                              
                              </EditItemTemplate>
                              <FooterTemplate>
                              <cc2:PostTextBox ID="codigoInsertTxt" runat="server" 
                               BackColor="Transparent"  ReadOnly="true" BorderColor="Transparent" Width="75px">

                              </cc2:PostTextBox>
                              </FooterTemplate>
                              </asp:TemplateField>
                              <asp:TemplateField HeaderText="Descripcion"    HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="360px">
                               <ItemTemplate>
                                        <asp:Label ID="descripcionLabel" runat="server" BackColor="Transparent" Text='<%# Eval("descripcion")%>'  />
                               </ItemTemplate>
                               <EditItemTemplate>
                                        <cc2:PostTextBox ID="descripcionEditTxt" runat="server"  BackColor="Transparent"  Text='<%# Eval("descripcion")%>' 
                                        DataType="List" method="GetRecursoDisponible"  OnSelect="SelectEdit"
                          onchange="javascript:validarEdit(this);"  
                          Width="330px" />
                           
                          <cc2:PostTextBox ID="descripcion2EditTxt" runat="server"  BackColor="Transparent"  
                          ReadOnly="true"   Width="0"    Text='<%# Eval("descripcion")%>' />
                          <cc2:PostTextBox ID="idInsumoEditTxt" runat="server" Text='<%# Eval("codigo")%>'  ReadOnly="true"  
                           BackColor="Transparent" Width="0"></cc2:PostTextBox></EditItemTemplate>
                           
                           <FooterTemplate>
                             

                           <cc1:Input ID="descripcionInsertTxt" runat="server"  BackColor="Transparent"  
                     DataType="List" method="GetRecursoDisponible"  OnSelect="SelectInsert"
                     onchange="javascript:validarInsert(this);"  Width="330px"  />
                     
                     <cc2:PostTextBox ID="idInsumoInsertTxt" runat="server"  ReadOnly="true"  BackColor="Transparent"
                      Width="0" />
                     
                     <cc2:PostTextBox ID="descripcionInsert2TextBox" runat="server"  ReadOnly="true" 
                      BackColor="Transparent" Width="0" />
                      
                      </FooterTemplate>
                      
                      </asp:TemplateField>
                      <asp:TemplateField HeaderText="Unidad" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="55px">
                      <ItemTemplate>
                      <asp:Label ID="unidadLabel" runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>' Width="55px"  />
                      </ItemTemplate>
                      <EditItemTemplate>
                      <cc2:PostTextBox ID="unidadEditTxt" runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>' Width="55px" ReadOnly="true"  />
                      </EditItemTemplate>
                      <FooterTemplate>
                      <cc2:PostTextBox ID="unidadInsertTxt" runat="server" BackColor="Transparent"  Width="55px"  ReadOnly="true"/>
                      </FooterTemplate>
                      </asp:TemplateField>


                      <asp:TemplateField HeaderText="Cantidad" HeaderStyle-HorizontalAlign="Right" 
                     ItemStyle-HorizontalAlign="Right"    HeaderStyle-Width="75px">
                     <ItemTemplate>
                     <asp:Label ID="cantidadLabel" runat="server" BackColor="Transparent" Text='<%# Eval("cantidad")%>'  />
                     </ItemTemplate>
                     <EditItemTemplate>
                     <cc2:PostTextBox ID="cantidadEditTxt" runat="server" BackColor="Transparent"  DataType="Double"   Width="75px"
                     Text='<%# Eval("cantidad")%>' onchange="javascript:calcularTotalXCantReAgrupadoEdit(this);" />
                     
                     </EditItemTemplate>
                     <FooterTemplate>

                     <cc1:Input ID="cantidadInsertTxt" runat="server" BackColor="Transparent" DataType="Double"   Width="75px" Text="0"
                      onchange="javascript:calcularTotalXCantReAgrupadoInsert(this);" />

                     </FooterTemplate>
                     
                     </asp:TemplateField>



                     <asp:TemplateField HeaderText="Precio" HeaderStyle-HorizontalAlign="Right" 
                     ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px">
                     <ItemTemplate>
                     <asp:Label ID="precioLabel" runat="server" BackColor="Transparent" Text='<%# Eval("precioStr")%>'  />
                     </ItemTemplate>
                     <EditItemTemplate><cc2:PostTextBox ID="precioEditTxt" runat="server" BackColor="Transparent" DataType="Double"  
                     Font-Size="X-Small" Width="75px"       Text='<%# Eval("precio")%>'
                     onchange="javascript:calcularTotalXPrecioAgrupadoEdit(this);" />
                     </EditItemTemplate>
                     
                     <FooterTemplate>
                     <cc2:PostTextBox ID="precioInsertTxt" runat="server" BackColor="Transparent" Font-Size="X-Small" Width="75px" DataType="Double" 
                       onchange="javascript:calcularTotalXPrecioAgrupadoInsert(this);" />
                     
                     </FooterTemplate>
                     </asp:TemplateField>



                     <asp:TemplateField HeaderText="Total" HeaderStyle-HorizontalAlign="Right" 
                      ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px">
                     <ItemTemplate>
                     <asp:Label ID="totalLabel" runat="server" BackColor="Transparent" Text='<%# Eval("totalStr")%>'  />
                     
                     </ItemTemplate>
                     <EditItemTemplate>
                     <cc2:PostTextBox ID="totalEditTxt" runat="server" BackColor="Transparent" DataType="Double" 
                      Width="75px" Text='<%# Eval("total")%>' 
                      onchange="javascript:calcularPrecioXTotalAgrupadoEdit(this);" />
                        </EditItemTemplate>

                        <FooterTemplate>
                        <cc2:PostTextBox ID="totalInsertTxt" runat="server" BackColor="Transparent" DataType="Double"  Width="75px"
                        onchange="javascript:calcularPrecioXTotalAgrupadoInsert(this);" />
                        
                        </FooterTemplate>


                       </asp:TemplateField>






                       <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/cancel.gif"  HeaderStyle-Width="20px"
                            EditImageUrl="~/Images/edit.gif" ShowEditButton="true" 
                            UpdateImageUrl="~/Images/update.gif" />
                            
                            <asp:TemplateField HeaderStyle-Width="20px">
                            <ItemTemplate>
                            <asp:ImageButton ID="lnkRemove" runat="server" BorderColor="Control"  
                                    CommandArgument='<%# Eval("idInternal")%>' OnClick="DeleteNewItem" 
                                    OnClientClick="return confirm('Usted quiere eliminar?')"  ImageUrl="~/Images/delete.gif"   />
                                    </ItemTemplate>
                                    
                                    <FooterTemplate><asp:Button ID="Button1" runat="server" Text="Añadir" CssClass="ms-crm-List-Header" OnClick="AddNewItem" /></FooterTemplate></asp:TemplateField></Columns>
                  
                  
                  </asp:GridView>
                  
                  </ContentTemplate>
                  </asp:UpdatePanel>
                  </asp:Panel>
        </ContentTemplate>
        </asp:TabPanel>
        </asp:TabContainer>

   
 

<%--
   
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosTabPanel$AgruparRecursoButton" />
<asp:AsyncPostBackTrigger ControlID="finalizarAgrupadoButton" />
<asp:AsyncPostBackTrigger ControlID="aceptarAddButton" />

</Triggers>
               </asp:UpdatePanel>--%>
         </asp:Panel>